package com.biallen.datastructure.linkedlist;


import com.biallen.datastructure.entity.HeroNode;

public class LinkedListInterview {
    public static void main(String[] args) {
        SingleLinkedList singleLinkedList = new SingleLinkedList();
        //求单项链表中的有效节点个数
        singleLinkedList.addByOrder(new HeroNode(1, "宋江", "及时雨"));
        singleLinkedList.addByOrder(new HeroNode(3, "吴用", "智多星"));
        singleLinkedList.addByOrder(new HeroNode(5, "关胜", "大刀"));
        singleLinkedList.addByOrder(new HeroNode(6, "林冲", "豹子头"));
        singleLinkedList.addByOrder(new HeroNode(4, "公孙胜", "入云龙"));
        singleLinkedList.addByOrder(new HeroNode(2, "卢俊义", "玉麒麟"));
         System.out.println("节点有效长度为:"+singleLinkedList.getSize());
        // singleLinkedList.displayList();
        //查找链表 倒数第k个节点 【新浪面试】 例如查找倒数第二个
       // System.out.println(singleLinkedList.findNodeByIndex(singleLinkedList.getSize()-2));
        System.out.println("链表反转");
        HeroNode heroNode = singleLinkedList.reversalList(singleLinkedList.getHeadNode());
        singleLinkedList.displayList(heroNode);
       // System.out.println(heroNode );

        // 链表反转面试题
    }
}
